
$(document).ready(function() {	
	$("#unclebai").removeClass("sub-menu-link").addClass("selected");
	window.random_code_index = 0;
	$("#defButton").click(function() {		
		var randomN = getRandomNum();
		$("#merOrderNum").val(randomN);		
		
	});
		
	//商户订单号
	$("#merOrderNum").val(getRandomNum());
	
	$.formValidator.initConfig({
		validatorgroup : "1",
		formid : "form",
		onerror : function(input1, input2) {
			return false;
		}
	});

	$("#tranCode").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "交易码不允许为空！"
	});
	
	$("#merchantId").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "商户ID不允许为空！"
	});
	
	$("#merOrderNum").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "订单号不允许为空！"
	});
	
	$("#tranDateTime").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "交易时间不允许为空！"
	});

	

	$("#agentSingNo").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "协议号不允许为空！"
	});$("#bankCode").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "银行代码不允许为空！"
	});$("#type").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "业务类型不允许为空！"
	});$("#bankNo").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "银行卡号不允许为空！"
	});$("#mobile").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "手机号不允许为空！"
	});
	$("#realname").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "真实姓名不允许为空！"
	});$("#certificateType").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "证件类型不允许为空！"
	});$("#certificateNo").formValidator({
		onshow : " "
	}).inputValidator({
		min : 1,
		onerror : "证件号不允许为空！"
	});
	



	$("#agentSingNo").formValidator({
		onshow: " "
	}).inputValidator({
		min: 1,
		onerror: "协议号不允许为空！"
	});
	
});

function getRandomNum() {
	window.random_code_base = (([ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J',
			'K', 'M', 'N' ])[new Date().getMonth()])
			+ '_' + (Math.random() * 10000000000 + '').substring(0, 4);	
	return window.random_code_base + "_" + (window.random_code_index++);
}